<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="util" uri="/WEB-INF/kdd-util.tld" %>
<%@taglib prefix="sec" uri="http://www.springframework.org/security/tags" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<sec:authorize access="isAuthenticated()">
    <html>
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        </head>
        <body>
            <jsp:include page="menu.jsp" />
            <div class="notfullnomargin">
                <h3>${project.name}<br /><small> <spring:message code="msg.createdby" /> ${project.creator.username} <spring:message code="msg.on" />: <fmt:formatDate value="${project.creationDate}" pattern="MM/dd/yyyy HH:mm"/></small></h3><br />
                <div class="columnholder row">
                    <div class="well columnleft">
                        <b><spring:message code="msg.subprojects" />:</b><br /><br />
                        <c:choose>
                            <c:when test="${empty subProjects}">
                                <spring:message code="msg.nosubprojects" />
                            </c:when>
                            <c:otherwise>
                                <input type="text" id="subprojectfilter" placeholder="Filter" />
                                <ul id="subprojectlist">
                                    <c:forEach items="${subProjects}" var="sp">
                                        <li><span><a href="<c:url value='/subproject/${sp.id}'/>">${sp.name}</a></span></li>
                                    </c:forEach>
                                </ul>
                            </c:otherwise>
                        </c:choose>
                    </div>
                    <div class="well columnright">
                        <b><spring:message code="msg.methods" />:</b><br /><br />
                        <c:choose>
                            <c:when test="${empty project.methods}">
                                <spring:message code="msg.nomethods" />
                            </c:when>
                            <c:otherwise>
                                <input type="text" id="methodfilter" placeholder="Filter" />
                                <ul id="methodlist">
                                    <c:forEach items="${project.methods}" var="sp">
                                        <li><span>${sp.showName}</span></li>
                                    </c:forEach>
                                </ul>
                            </c:otherwise>
                        </c:choose>
                    </div>
                </div>
                <c:if test="${not empty project.description}">
                    <div class="well">
                        <b><spring:message code="msg.description" />:</b><br /><br />
                        ${util:nl2br(project.description)}
                    </div>
                </c:if>
                <c:url var="commentAction" value="/comment/project/add/${project.id}" />
                <%@include file="includes/commentform.jsp"%>
                <c:if test="${not empty comments}">
                    <div>
                        <b><spring:message code="msg.comments" />:</b><br /><br />
                        <c:forEach items="${comments}" var="pc">
                            <div class="well">
                                <h5>${pc.creator.username}, <small><fmt:formatDate value="${pc.creationDate}" pattern="MM/dd/yyyy HH:mm"/></small></h5><br />
                                ${util:nl2br(pc.text)}
                            </div>
                        </c:forEach>
                    </div>
                </c:if>
            </div>
            <script type="text/javascript">
                $("#subprojectfilter").keyup( function() {
                    filterList($("#subprojectlist"), $(this).val());
                });
                $("#methodfilter").keyup( function() {
                    filterList($("#methodlist"), $(this).val());
                });
            </script>
            <jsp:include page="foot.jsp" />
        </sec:authorize>